#!/bin/sh
if [ ! -f "${HOME}/.gitconfig" ]; then
    git config --global user.name "${gituser}"
    git config --global user.email "${gitemail}"
fi
if [ ! -d ".git" ]; then
    echo "未检测到git仓库, 已初始化"
    git init
fi
while true; do
    git add .
    git commit -m "AutoGit Auto Commit"
    # shellcheck disable=SC2010
    ls "$HOME"/.ssh/id*.pub >/dev/null 2>&1 || (ls -l "$HOME"/.ssh/id* 2>/dev/null | grep "\-rw------- 1 $(whoami)" >/dev/null 2>&1 && echo ok)
    date
    git log | cat -
    sleep "${sleepTime}"
done
